
Msg = {
	info:function(msg,time){
		var new_div = document.createElement('div');
		new_div.id = "msg";
		new_div.className = "info";
		var html = '<div class="toast-icon"><img src="img/info.png"></div><div class="toast-tip">'+msg+'</div></div>';
		new_div.innerHTML = html;
		document.body.appendChild(new_div);
		setTimeout(()=>{
			document.body.removeChild(new_div);
		},time || 3000);
	},
	warn:function(msg,time){
		var new_div = document.createElement('div');
		new_div.id = "msg";
		new_div.className = "warn";
		var html = '<div class="toast-icon"><img src="img/warn.png"></div><div class="toast-tip">'+msg+'</div></div>';
		new_div.innerHTML = html;
		document.body.appendChild(new_div);
		setTimeout(()=>{
			document.body.removeChild(new_div);
		},time || 3000);
	},
	erro:function(msg,time){
		var new_div = document.createElement('div');
		new_div.id = "msg";
		new_div.className = "erro";
		var html = '<div class="toast-icon"><img src="img/erro.png"></div><div class="toast-tip">'+msg+'</div></div>';
		new_div.innerHTML = html;
		document.body.appendChild(new_div);
		setTimeout(()=>{
			document.body.removeChild(new_div);
		},time || 3000);
	},
	success:function(msg,time){
		var new_div = document.createElement('div');
		new_div.id = "msg";
		new_div.className = "success";
		var html = '<div class="toast-icon"><img src="img/success.png"></div><div class="toast-tip">'+msg+'</div></div>';
		new_div.innerHTML = html;
		document.body.appendChild(new_div);
		setTimeout(()=>{
			document.body.removeChild(new_div);
		},time || 3000);
	},
}

dilog = {
	conform:function(msg,data,callback){
		var new_div = document.createElement('div');
		new_div.id = "dilog_box";
		var html = '<div id="dilog"></div><div class="msg_box"><div class="dilog_msg">'+msg+ '</div><button id="sure" class="btn_sure">确定</button><button id="cancle" class="btn_cancle">取消</button><div>';
		new_div.innerHTML = html;
		document.body.appendChild(new_div);
		
		var btn_sure = document.getElementById("sure");
		var btn_cancle = document.getElementById("cancle");
		btn_sure.onclick = function(){//确定按钮点击,关闭dilog,执行回调
			var dilog_box = document.getElementById("dilog_box");
			dilog_box.remove();
			callback(data);
		}
		
		btn_cancle.onclick = function(){//取消按钮点击，关闭dilog
			var dilog_box = document.getElementById("dilog_box");
			dilog_box.remove();
		}
	}
}